year = eval(input("请输入年份:"))
week1 = eval(input("请输入星期几："))

isLeap = (year%4==0 and year %100 !=0) or (year%400==0)

day = 0
for i in range(1,13):
    week = (day % 7 + week1) % 7
    if i==1 or i==3 or i==5 or i==7 or i==8 or i==10 or i==12:
        day += 31
    elif i==2:
        if isLeap:
            day += 29
        else:
            day += 28
    else:
        day += 30
    print("一月" if i==1 \
        else "二月" if i==2 \
        else "三月" if i==3 \
        else "四月" if i==4 \
        else "五月" if i==5 \
        else "六月" if i==6 \
        else "七月" if i==7 \
        else "八月" if i==8 \
        else "九月" if i==9 \
        else "十月" if i==10 \
        else "冬月" if i==11 \
        else "腊月"," 1,",year,"is ",\
          "星期天" if week==0 \
          else "星期一" if week==1 \
          else "星期二" if week==2 \
          else "星期三" if week==3 \
          else "星期四" if week==4 \
          else "星期五" if week==5 \
          else "星期六"
    )


